.TH PSI 1 "2013-06-09" "HH" "pce"
\
.SH NAME
psi \- convert and modify sector image files

.SH SYNOPSIS
.BI psi " [options] [input-file] [options] [output-file]"

.SH DESCRIPTION
\fBpsi\fR(1) is used to modify and convert sector images
files.

.SH OPTIONS
.TP
.BI "-a, --alternate " "alt1[-alt2]"
Select a range of alternate sectors.
\
.TP
.BI "-c, --cylinder " "cyl1[-cyl2]"
Select a range of cylinders.
\
.TP
.BI "-e, --edit " "what val"
For all selected sectors, set sector attribute \fIwhat\fR to \fIval\fR.
For boolean attributes, a value of 0 disables the attribute and any other
value enables it.
Recognized attributes are:
.RS
.TP
.B c
The cylinder number in the sector ID.
.TP
.B crc-id
The ID field contains a CRC error.
.TP
.B crc-data
The data field contains a CRC error.
.TP
.B del-dam
The sector has a deleted data address mark.
.TP
.B data
Initialize the sector data with \fIval\fR.
.TP
.B fm
The sector uses IBM single density FM encoding.
.TP
.B gcr
The sector uses Macintosh GCR encoding.
.TP
.B h
The head number in the sector ID.
.TP
.B mfm
The sector uses IBM double density MFM encoding.
.TP
.B mfm-hd
The sector uses IBM high density MFM encoding.
.TP
.B mfm-ed
The sector uses IBM extra high density MFM encoding.
.TP
.B no-dam
The sector has a missing data address mark.
.TP
.B position
The sector position in data bits from the start of the track.
.TP
.B round-time
If the sector read time is within \fIval\fR/100 percent of the
normal value, round it to the normal value.
.TP
.B s
The sector number in the sector ID.
.TP
.B size
The sector size in bytes.
.TP
.B tags
If \fIval\fR is zero, remove sector tags, otherwise add sector tags.
.TP
.B time
The sector read time, in data bits.
.RE
\
.TP
.B "-f, --info"
Print information about the current image or the next image loaded.
\
.TP
.BI "-F, --filler " val
Set the fill byte to \fIval\fR. The fill byte is used when sectors
are created or enlarged.
\
.TP
.BI "-h, --head " "head1[-head2]"
Select a range of heads.
\
.TP
.BI "-i, --input " filename
Load an image from \fIfilename\fR.
\
.TP
.BI "-I, --input-format " format
Set the input file format to \fIformat\fR.
Valid formats are:
.RS
.TP
.B ana
The anadisk dump format.
.TP
.B cp2
The Copy II PC / Snatchit disk image format. Support for this format
is experimental. This format is only available as an input format.
.TP
.B dc42
The Apple Disk Copy 4.2 file format.
.TP
.B imd
The ImageDisk file format.
.TP
.B msa
The Magic Shadow Archive image file format.
.TP
.B pfdc
The PFDC file format. This has been superseded by PSI.
.TP
.B psi
The native PCE sector image file format.
.TP
.B raw
A raw sector dump.
.TP
.B st
The same as raw, but the auto-detected disk geometries are the ones
common on the Atari ST.
.TP
.B stx
The Pasti STX file format. This format is only supported as an input
format and some information will be lost because PSI does not preserve
the track images that may be present in STX files.
.TP
.B tc
Transcopy dump format. Support for this format is highly experimental.
This format is only available as an input format.
.TP
.B td0
The teledisk file format. Only files that don't use advanced compression
are supported.
.TP
.B xdf
IBM XDF disk images.
.RE
\
.TP
.B "-l, --list-tracks"
List all tracks in the current image or in the next image loaded.
\
.TP
.B "-L, --list-sectors"
List all sectors in the current image or in the next image loaded.
\
.TP
.BI "-m, --merge " filename
Load an image from \fIfilename\fR and merge it with the current
image. Sectors that are identical are discarded. Sectors that
exist in only one image are retained. Sectors that exist in both
images, but differ, are added as alternate sectors.
\
.TP
.BI "-n, --new-dos " size
Create a new DOS image of size \fIsize\fR KiB. Valid sizes are
160, 180, 200, 320, 360, 400, 640, 720, 800, 1200, 1440 and 2880.
\
.TP
.BI "-N, --new " "type size"
Create a new image of type \fItype\fR and size \fIsize\fR. Valid types
are \fBdos\fR and \fBmac\fR. Valid sizes for mac images are 800 and 1600.
\
.TP
.BI "-o, --output " filename
Set the output file name. Before exiting, the current image will
be written to this file.
\
.TP
.BI "-O, --output-format " format
Set the output file format to \fIformat\fR. See the \fI-I\fR option
for a list of valid formats.
\
.TP
.BI "-p, --operation " "name [arg...]"
Perform an operation on the current image. Valid operations are:
.RS
.TP
.BI "comment-add " text
Add \fItext\fR to the image comment.
.TP
.BI "comment-load " filename
Load the image comment from file \fIfilename\fR.
.TP
.B comment-print
Print the current image comment.
.TP
.BI "comment-save " filename
Save the current image comment to \fIfilename\fR.
.TP
.BI "comment-set " text
Set the image comment to \fItext\fR.
.TP
.B delete
Delete all selected sectors.
.TP
.B info
Print information about the current image (same as \fB-f\fR).
.TP
.BI "interleave " n
Set the sector interleave on all selected tracks to \fIn\fR.
.TP
.BI "load " filename
Load the contents of all selected sectors from \fIfilename\fR. The
contents of the sectors are read sequentially from the file.
.TP
.B new
Create all selected sectors, if they do not already exist.
.TP
.BI "reorder " "s1,s2,s3,..."
Reorder the sectors on all selected tracks. Sectors that are not
mentioned in the parameter are moved to the end of the track.
.TP
.BI "rotate " first
Rotate the sectors on all selected tracks such that \fIfirst\fR is
the first sector on the track. If \fIfirst\fR does not exist on
a track, the next higher sector will be rotated to the start of
the track.
.TP
.BI "save " filename
Save all selected sectors to \fIfilename\fR. The contents of the
sectors are written sequentially to the file.
.TP
.B sort
Sort the sectors on all selected tracks in ascending order.
.TP
.B sort-reverse
Sort the sectors on all selected tracks in descending order.
.TP
.BI "tags-load " filename
Load the sector tags for all selected sectors from \fIfilename\fR.
For each sector 12 bytes are read, in the order in which the
sectors appear on the track.
.TP
.BI "tags-save " filename
Save the sector tags for all selected sectors to \fIfilename\fR.
For each sector 12 bytes are written, in the order in which the
sectors appear on the track.
.RE
\
.TP
.BI "-r, --record " "cyl1[-cyl2] head1[-head2] sect1[-sect2]"
Select sectors. This is the same as using the \fB-c\fR, \fB-h\fR
and \fB-s\fR options seperately.
\
.TP
.BI "-s, --sector " "sect1[-sect2]"
Select a range of logical sectors.
\
.TP
.BI "-S, --real-sectors " "sect1[-sect2]"
Select a range of physical sectors.
\
.TP
.B "-v, --verbose"
Enable verbose operation.
\
.TP
.B "-x, --invert"
Invert the selection.
\
.TP
.B --help
Print usage information.
\
.TP
.B --version
Print version information.

.SH EXAMPLES
Convert an ImageDisk file to a PSI file:
.IP ""
$ psi source.imd dest.psi
.PP
Get image information:
.IP
$ psi -f image.psi
.PP
Add sectors 10 and 11 to all tracks on side 0:
.IP
$ psi -i source.psi -r all 0 10-11 -p new -o dest.psi
.PP
Mark the first sector in the image as having a bad data CRC:
.IP
$ psi -i source.psi -r 0 0 1 -e crc-data 1 -o dest.psi
.PP
Set the image comment:
.IP
$ psi -i source.psi -p comment-set "Test image" -o dest.psi

.SH SEE ALSO
.BR pce-ibmpc "(1),"
.BR pce-macplus "(1),"
.BR pce-img "(1)"

.SH AUTHOR
Hampa Hug <hampa@hampa.ch>
